/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Lab_v3;
import java.util.Hashtable;
/**
 *
 * @author salman
 */
public class dbtables_question_metadata extends dbtables_handler {

    private static String table_name= "question_metadata";

    public dbtables_question_metadata(String database_type,String database_name)
    {
       super(database_type,database_name);
//        if (table_name != null)
//        {
//           table_name =  new_table_name;
//        }
        p_table_name = table_name;

    }

    public void insertSingleEntry(String key,String question_number,String question_string,String test_id)
    {
        String insertParameters = "'"+key+"','"+question_number+"','"+question_string+"','"+test_id+"'";
       // insertParameters = "'18','jsdfsdfhds','sdsdfdsfsdfsd'";
       // String s = "'11','shit','de  sdfsdf s fdsshit'";
        insertData(insertParameters);

    }

    public void viewAllEntries()
    {
      String[] fieldNames = {"question_id","question_number","question_string","test_id"};
        fetchAndViewAllData (fieldNames);

    }

        public Hashtable getSingleQuestion(String searchfeildColumn,String searchfieldValue)
    {
       String[] fieldNames = {"question_id","question_number","question_string","test_id"};
       Hashtable a = new Hashtable();
   a = fetchSingleRow (searchfeildColumn,searchfieldValue,fieldNames);
       return a;
    }

public Hashtable getQuestionStrings(String searchfeildColumn,String searchfieldValue)
    {
       String[] fieldNames = {"question_string"};
       Hashtable a = new Hashtable();
   a = fetchSingleRow (searchfeildColumn,searchfieldValue,fieldNames);
       return a;
    }

        public Hashtable getAllQuestionsFromTable()
    {
       String[] fieldNames = {"question_id","question_string","test_id"};
       Hashtable a = new Hashtable();
   a = fetchAllRows (null,null,fieldNames);
       return a;
    }

        public Hashtable getQuestion(String test_id,String question_number)
    {
      // String[] fieldNames = {"question_id","question_string","test_id"};
       Hashtable a = new Hashtable();
   a= getSingleQuestionsForTest(test_id,question_number);
      return a;
        }
}
